//  This file is part of Swordbible - http://www.swordwarrior.net
//  Copyright (C) 2003-2009 Manu Mital mital.manu@gmail.com

//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2, or (at your option)
//  any later version.

//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.

//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software Foundation,
//  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#pragma once
#include "afxwin.h"
#include "afxcmn.h"
#include "SwordBibleFonts.h"
#include "MyToolBar.h"
#include "AutoRichEditCtrl.h"
#include <swld.h>


// CBottomLeft dialog

class CBottomLeft : public CPropertyPage
{
	DECLARE_DYNAMIC(CBottomLeft)

public:
	CBottomLeft();
	sword::SWLD* pModule;
	static int active;
	virtual ~CBottomLeft();
	static CString ActiveMainFrameCommand;
	static CSwordBibleFonts font;

// Dialog Data
	enum { IDD = IDD_DIALOG_BOTTOMLEFT };

protected:
	CMyToolBar m_wndFormatBar;

	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnSize(UINT nType, int cx, int cy);
	virtual BOOL OnInitDialog();
	virtual BOOL OnSetActive();
	int GetNumEntries();
	int FindEntry(CString& toFind);
	BOOL OnToolTipNotify(UINT id, NMHDR *pNMHDR,   LRESULT *pResult);
  void OnSearchDict();
	void ShowText(int sel);
	


	// words in the dictionary that start with the letter of the alphabet user has selected

	
	LONG OnMainFrameCommand(UINT, LONG);
	
	afx_msg void OnBottomleftCopy();
	afx_msg void OnSelectAll();
	afx_msg void OnBottomleftFont();
	afx_msg void OnPrint();
	afx_msg void GetDispInfo(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnItemChanged(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnShowVersions();

	afx_msg void OnZoom();
	afx_msg void OnUpdateZoom(CCmdUI *pCmdUI);

	afx_msg void OnPrevious();
	afx_msg void OnNext();
  afx_msg void OnInfo();


	CComboBox words;
	CComboBox alphabet;	
	CAutoRichEditCtrl m_lxRich;
	CListCtrl EntriesList;
	CEdit SearchEdit;
	
private:
  void LoadToolbar();
	void ZoomText();
	void OnRightButtonDown();

	// used for searching
	int numEntries;	
	CString KEYText; // this stores the key text at various positions while the search is on
	int result;
	int high;
	int low;
	int mid;
	UINT last_pos;
	 CString search;
	int FoundIndex;


	afx_msg void OnEnMsgfilter(NMHDR *pNMHDR, LRESULT *pResult);
public:
  afx_msg void OnFocusSearchEditBox();
  virtual BOOL PreTranslateMessage(MSG* pMsg);
};
